<style>
        section .tabs-wrapper{
                display: none;
        }
        .user-pass-form{
               margin-left: 40%;
        }
        .form-item.form-type-textfield.form-item-cell{
            float: left;
            margin-right: 10px;
        }
        .register-ul{
            margin-right: auto;
            margin-left: auto;
            width: 1000px;
        }
        .register-ul li{
            float: left;
            width: 50%;
            line-height: 30px;
            margin-bottom: 20px;
            text-align: center;
        }
        .check-on{
            background: #387ef5;
            color: #FFF;
        }
</style>
<?php if(strpos($_SERVER['HTTP_REFERER'],'contact/list')){?>
    <style>
        div.navbar,header.container-wrapper ,div#block-portal-main-menu,footer,.breadcrumb{
            display:none;
        }
        .container {
            width:100%;
        }
        .container-wrapper,
        .user-pass-form,
        #main #content{
            margin: 0px;
        }
        body{
            background-color:#ecf9ff;
        }
        .check-on {
            width: 49% !important;
            background: rgb(93, 194, 67);
            color: #FFF;
        }
        .login-submit{
            margin-left: 100px;
        }   
        .user-pass-form.email .search-label{
            width: 225px !important;
        }
        .user-pass-form.phone .search-label{
            width: 180px !important;
        }
        .register-ul input{
            border:1px solid rgb(93, 194, 67);
        }
        .pass_logo {
            margin-top: 80px;
            width: 100%;
            text-align: center;
            height: 105px;
            overflow: hidden;
        }
    </style>
    <div class="pass_logo"><img src="<?php echo base_path() ?>sites/all/themes/tweme/images/images/small-login.png" class="small-login"></div>
<?php }?>

<div class="user_pass_page">
<div class="register-ul" style="width: 100%;">
    <input type="radio" name="sec" class="check-on register-li" value="邮箱" checked="">邮箱
    <input type="radio" name="sec" class="register-li" style="margin-left: 50%" value="手机">手机
</div>
<!--<div class="login-div">-->
    <div class="user-pass-form email" style="margin-left: 30%;margin-top: 40px">
           <div class="search-label" style="width: 150px; ">用户名或电子邮件地址: </div>
           <div class="big-input" style="float:left"><?php print render($form['name']); ?></div>
           <div class="login-submit" style="clear:both;float:left"><?php print render($form['actions']); ?></div>
    </div>
    <div class="user-pass-form phone" style="display: none;margin-left: 25%;margin-top: 40px;">
        <div class="search-label" style="width: 150px">手机号: </div>
        <div class="big-input" style="float: left;"><?php print render($form['cell']); ?></div>
        <div class="search-label" style="width: 150px">图形验证码: </div>
        <div class="big-input" style="float:left;"><?php print render($form['graph_code']); ?><?php print render($form['refresh_graph_code']); ?><div style="float: right;  "><?php print render($form['sms_send']); ?></div></div>
<!--        <div>--><?php //print render($form['sms_msg']); ?><!--</div>-->
        <div class="search-label" style="width: 150px">验证码: </div>
        <div class="big-input" style="float:left"><?php print render($form['sms_code']); ?></div>
        <div class="login-submit" style="clear:both;float:left;margin-left:50px"><input class="btn btn-primary form-submit" type="button" value="验证" id="check_code"/></div>
    </div>
</div>
<?php print drupal_render_children($form); ?>
<script>
    jQuery('.register-li').click(function(){
        jQuery('.register-li').removeClass('check-on');
        jQuery(this).addClass('check-on');
        if(jQuery(this).val() == '邮箱'){
            jQuery('.email').show();
            jQuery('.phone').hide();
        }else{
            jQuery('.email').hide();
            jQuery('.phone').show();
        }
    })


    jQuery('#check_code').click(function(){
        var flag = 0;
        if(jQuery('input[name="cell"]').val()) {
                if (!jQuery('input[name="sms_code"]').val()) {
                    alert("请填写短信验证码！");
                    return false;
                } else {
                    if (window.location.host == 'www.metercomm.com.cn') {
                        var url = '/nonghua/api/sms/login';
                    } else {
                        var url = '/api/sms/login';
                    }
                    jQuery.ajax({
                        url: url,
                        data: {"userCell":jQuery('input[name="cell"]').val(),"checkDigit":jQuery('input[name="sms_code"]').val()},
                        type: 'post',
                        datatype: 'json',
                        async: false,
                        success: function (data) {
                            if (data.sms_check) {
                               alert('验证成功，进入修改密码页面');
                                if (window.location.host == 'www.metercomm.com.cn') {
                                    window.location.href='/nonghua/account/change_password?source=register';
                                } else {
                                    window.location.href='/account/change_password?source=register';
                                }

                            } else {
                                if (data.error == 1) {
                                    alert("校验码过期！");
                                } else if (data.error == 2) {
                                    alert("校验码错误！");
                                }else if(data.error == 3){
                                    alert("校验码不能为空！");
                                }else if(data.error == 4){
                                    alert("用户不存在！");
                                }

                            }
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert('textStatus:' + textStatus + XMLHttpRequest.status + errorThrown);
                        },

                    });
                }
        }else{
            alert('请填写手机号！');return false;
        }
    })
</script>
